package main

import (
	"container/list"
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"reflect"
)

type candidate struct {
	fileinfo os.FileInfo
}

func gather_candidates(p string) *list.List {
	cs := list.New()
	files, err := ioutil.ReadDir(p)
	if err != nil {
		log.Fatal(err)
	}

	for _, file := range files {
		c := candidate{file}
		cs.PushBack(c)
		// fmt.Println(file.Name(), file.IsDir())
	}

	return cs
}

func main() {
	res := *gather_candidates(".")

	fmt.Println("type:", reflect.TypeOf(res))
	// 顺序遍历
	for e := res.Front(); e != nil; e = e.Next() {
		fmt.Println("type:", reflect.TypeOf(e))
		fmt.Println()
	}
}
